<?php

namespace common\models;

use Yii;
use yii\behaviors\TimestampBehavior;

/**
 * This is the model class for table "mops_bind_phone".
 *
 * @property int $id
 * @property string $phone
 * @property int $item_id
 * @property int $created_at
 * @property int $updated_at
 * @property int $attempt
 * @property string $msg
 * @property int $status
 */
class BindPhone extends \yii\db\ActiveRecord
{
    const STATUS_SUCCESS = 1;
    const STATUS_FAILURE = 0;

    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%bind_phone}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['item_id', 'created_at', 'updated_at', 'attempt', 'status'], 'integer'],
            [['phone'], 'string', 'max' => 11],
            [['msg'], 'string', 'max' => 255],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'phone' => '手机号',
            'item_id' => '类目ID',
            'created_at' => '创建时间',
            'updated_at' => '更新时间',
            'attempt' => '尝试次数',
            'msg' => 'Msg',
            'status' => '状态',
        ];
    }

    public function behaviors()
    {
        return [
            TimestampBehavior::class
        ];
    }

    public static function getStatusList()
    {
        return [
            self::STATUS_SUCCESS => '成功',
            self::STATUS_FAILURE => '失败'
        ];
    }
}
